// custom-tab-bar/index.js
Component({
    data: {
        active: 0,
        list: [{
                pagePath: "/pages/home/home",
                text: "首页",
                iconPath: "wap-home-o",
                selectedIconPath: "wap-home-o"
            }, {
                pagePath: "/pages/category/category",
                text: "分类",
                iconPath: "apps-o",
                selectedIconPath: "apps-o"
            }, {
                pagePath: "/pages/topic/topic",
                text: "专题",
                iconPath: "point-gift-o",
                selectedIconPath: "point-gift-o"
            },
            {
                pagePath: "/pages/car/car",
                text: "购物车",
                iconPath: "cart-o",
                selectedIconPath: "cart-o"
            },
            {
                pagePath: "/pages/user/user",
                text: "我的",
                iconPath: "manager-o",
                selectedIconPath: "manager-o"
            }
        ]
    },
    methods: {
        onChange(event) {
            // console.log(event.detail)
            let index = event.detail
            // event.detail 的值为当前选中项的索引
            this.setData({
                active: index
            });
            wx.switchTab({
                url: this.data.list[index].pagePath,
            })
        },
    }
})